package com.dsteiner.widgets.server.domain;

import java.util.List;

import com.dsteiner.widgets.client.domain.ModelObject;
import com.dsteiner.widgets.client.rpc.SearchResult;

public class DaoResult<T extends Object>{

	private List<T> objects;
	private int count;

	public DaoResult() {
	}
	
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	public List<T> getObjects() {
		return objects;
	}
	public void setObjects(List<T> objects) {
		this.objects = objects;
	}

	public <V extends ModelObject> SearchResult<V> toSearchResult() {
		SearchResult<V> searchResult = new SearchResult<V>();
		searchResult.setCount(count);
		searchResult.setObjects((List<V>) objects);
		return searchResult;
	}
}
